<script setup lang="ts">
import { ApiCatalogEnum, ApiDetail } from '@/api/api-manage/detail'
import { computed } from 'vue'
import aigcComponent from './trial-adapter/aigc'
import idCardComponent from './trial-adapter/idCard.vue'
import residentCardComponent from './trial-adapter/residentCard.vue'
import LLMComponent from './trial-adapter/llm.vue'
import objectDetectionComponent from './trial-adapter/objectDetection.vue'
import ocrComponent from './trial-adapter/ocr.vue'
import ocrOmni from './trial-adapter/ocrOmni.vue'
import faceLibraryComponent from './trial-adapter/faceLibrary.vue'
import facePictureComponent from './trial-adapter/facePicture.vue'
import STT from './trial-adapter/stt.vue'
import maskComponent from './trial-adapter/mask.vue'

const props = defineProps<{
  data: ApiDetail
}>()

const currentComponent = computed(() => {
  switch (props.data.apiCatalog) {
    case ApiCatalogEnum.OcrText.toString():
      return ocrComponent
    case ApiCatalogEnum.OcrLayout.toString():
      return ocrComponent
    case ApiCatalogEnum.OcrReceipt.toString():
      return ocrOmni
    case ApiCatalogEnum.ObjectDetect.toString():
      return objectDetectionComponent
    case ApiCatalogEnum.AIGC.toString():
      return aigcComponent
    case ApiCatalogEnum.IdCard.toString():
      return idCardComponent
    case ApiCatalogEnum.ResidentCard.toString():
      return residentCardComponent
    case ApiCatalogEnum.STT.toString():
      return STT
    case ApiCatalogEnum.LLM.toString():
      return LLMComponent
    case ApiCatalogEnum.FaceLibrary.toString():
      return faceLibraryComponent
    case ApiCatalogEnum.FacePicture.toString():
      return facePictureComponent
    case ApiCatalogEnum.Mask.toString():
      return maskComponent
    default:
      return null
  }
})
</script>

<template>
  <div>
    <component :is="currentComponent" :data="data" />
  </div>
</template>
